import { ApiProperty } from '@nestjs/swagger'
import { Type } from 'class-transformer'
import { IsInt, IsOptional } from 'class-validator'
import { CUserStatus } from '../constant'

export class QueryUserHistoryDto {
  @ApiProperty({ description: '用户ID', required: true })
  @IsInt()
  userId: number

  @ApiProperty({ description: '页码', required: false, default: 1 })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  page?: number = 1

  @ApiProperty({ description: '每页记录数', required: false, default: 10 })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  pageSize?: number = 10
}

export class UserHistoryResponseDto {
  @ApiProperty({ description: '历史记录ID' })
  id: number

  @ApiProperty({ description: '用户ID' })
  userId: number

  @ApiProperty({ description: '编辑者ID' })
  editorId: number

  @ApiProperty({ description: '编辑者姓名' })
  editorName: string

  @ApiProperty({ description: '编辑前的用户阶段', enum: CUserStatus })
  statusBefore: CUserStatus

  @ApiProperty({ description: '编辑后的用户阶段', enum: CUserStatus })
  statusAfter: CUserStatus

  @ApiProperty({ description: '编辑前的备注' })
  markBefore: string

  @ApiProperty({ description: '编辑后的备注' })
  markAfter: string

  @ApiProperty({ description: '其他修改内容摘要' })
  changes: string

  @ApiProperty({ description: '创建时间' })
  createdAt: Date
} 